<%= grid(@users,show_filters: :when_filtered) do |g|
    g.action_column  object_property: :id
    # g.column name: 'ID', attribute: 'id'
    g.column name: '姓名', attribute: 'name' do |user|
      link_to user.name, user_path(user)
    end
    g.column name: '管理员', attribute: 'is_sys_admin' do |user|
      boolean_label user.is_sys_admin
    end
    g.column name: '邮箱', attribute: 'email'
    g.column name: '登录',attribute: 'sign_in_count' do |user|
      user.sign_in_count
    end
    # g.column name: '最后登录时间', attribute: 'last_sign_in_at' do |user|
    #   time_str user.last_sign_in_at
    # end
    g.column name: '可用', attribute: 'enabled' do |user|
      boolean_label user.enabled
    end
    g.column name: '创建者',filter: false, attribute: 'creator_id' do |user|
      user.creator.nil? ? "" : link_to(user.creator.name,user_path(user))
    end
    g.column name: '修改时间',attribute: 'created_at'  do |user|
      time_str user.updated_at
    end
    g.column do |user|
       render :partial=>'/users/grid_button',:locals=>{:user=>user}
    end
end %>